import { createRouter, createWebHistory } from "vue-router";

export const routes = [
  {
    path: "/",
    redirect: "/layout",
  },
  {
    path: "/layout",
    name: "LayOut",
    component: () => import("@/layout/index.vue"),
    redirect: "/home",
    children: [
      {
        path: "/home",
        name: "Home",
        component: () => import("@/pages/home/index.vue"),
        meta: {
          title: "首页",
          icon: "home-o",
        },
      },
      {
        path: "/client",
        name: "Client",
        component: () => import("@/pages/client/index.vue"),
        meta: {
          title: "客户",
          icon: "friends-o",
        },
      },
      {
        path: "/task",
        name: "Task",
        component: () => import("@/pages/task/index.vue"),
        meta: {
          title: "任务",
          icon: "todo-list-o",
        },
      },
      {
        path: "/my",
        name: "My",
        component: () => import("@/pages/my/index.vue"),
        meta: {
          title: "我的",
          icon: "contact-o",
        },
      },
    ],
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("@/pages/login/index.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
